import { defineConfig } from '@vben/vite-config';

export default defineConfig(async () => {
  return {
    application: {},
    vite: {
      server: {
        proxy: {
          '/api/admin': {
            changeOrigin: true,
            // mock代理目标地址
            target: 'http://uni-backend:5200',
          },
          '/api/freelancer': {
            changeOrigin: true,
            // mock代理目标地址
            target: 'http://uni-backend:5200',
          },
          '/api': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/api/, ''),
            // mock代理目标地址
            target: 'http://localhost:5320/api',
            ws: true,
          },
        }
        ,
        allowedHosts: [
          'admin.leyepai.com',
          'admin.leyepai.local',
          'localhost',
          '127.0.0.1',
          '0.0.0.0',
          '.leyepai.local'
        ]
      },
    },
  };
});
